import random

money = 5000
while money > 0:
    a = random.randint(1, 10)
    print(a)
    b = int(input("请输入一个数字"))

    if a > b:
        print("大了")
        money = money - 500
    elif a < b:
        print("小了")
        money = money - 500
    else:
        print("恭喜猜中，本轮幸运数字:", a)
        money = money + 3000
        result=input("是否继续进行游戏？请输入：继续/结束")
        if result == "结束":
            break
    print("当前余额为",money)
print("游戏结束，当前余额为",money)